﻿<UserControl
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:SfdClient_Converter="clr-namespace:SfdClient.Converter" mc:Ignorable="d" x:Class="SfdClient.View.AccountEditorView" 
    Background="{DynamicResource mainBackgroundBrush}" d:DesignHeight="424.857" d:DesignWidth="939">
	<UserControl.Resources>
		<SfdClient_Converter:SyncMasterToBoolConverter x:Key="syncConverter"/>
	</UserControl.Resources>	
	
	<UserControl.DataContext>
		<Binding Path="AccountEditorViewModel" Source="{StaticResource locator}"/>
	</UserControl.DataContext>	
	
    <Grid >
    	<Grid.RowDefinitions>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition Height="*"/>
			<RowDefinition Height="Auto"/>
    	</Grid.RowDefinitions>
    	<Grid Height="64">
    		<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="64"/>
    			<ColumnDefinition Width="*"/>
    		</Grid.ColumnDefinitions>
    		<Button Style="{DynamicResource Win8ButtonStyle}" Command="{Binding BackCommand}" Height="48" VerticalAlignment="Center"  HorizontalAlignment="Left" >
    			<Image Source="{DynamicResource Back}" Height="48"/>
    		</Button>
    		<TextBlock TextWrapping="Wrap" Text="{Binding Title}" Style="{DynamicResource TitleStyle}" Grid.Column="1"/>
    	</Grid>
    	<Grid Grid.Row="1">
    		<Grid.RowDefinitions>
    			<RowDefinition Height="Auto"/>
    			<RowDefinition Height="*"/>
    			<RowDefinition Height="Auto"/>
    		</Grid.RowDefinitions>
     
    		<Grid>
    			<Grid.RowDefinitions>
    				<RowDefinition Height="Auto"/>
    				<RowDefinition Height="Auto"/>
    				<RowDefinition Height="Auto"/>
    				<RowDefinition Height="Auto"/>
    				<RowDefinition Height="Auto"/>
    			</Grid.RowDefinitions>
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition Width="130"/>
    				<ColumnDefinition Width="0.5*"/>
    				<ColumnDefinition Width="130" />
    				<ColumnDefinition Width="0.5*"/>
    			</Grid.ColumnDefinitions>
                <TextBlock Text="{Binding [AccountEditorView_Nom], Source={StaticResource localizer}}"  Style="{DynamicResource StandardStyle}" Grid.Row="0" />
				<TextBox Margin="5" Grid.Column="1" Text="{Binding FriendlyName}" VerticalAlignment="Center" Grid.Row="0" />

                <TextBlock Text="{Binding [AccountEditorView_CompteAzure], Source={StaticResource localizer}}"  Style="{DynamicResource StandardStyle}" Grid.Row="1" />
    			<TextBox Margin="5" Grid.Column="1" Text="{Binding AccountName}" VerticalAlignment="Center" Grid.Row="1" />

                <TextBlock Text="{Binding [AccountEditorView_CleAccess], Source={StaticResource localizer}}"  Grid.Column="2" Style="{DynamicResource StandardStyle}" Grid.Row="1" />
    			<TextBox Margin="5" Grid.Column="3" Text="{Binding SharedKey}" VerticalAlignment="Center" Grid.Row="1"  />

                <TextBlock Text="{Binding [AccountEditorView_Container], Source={StaticResource localizer}}"  Grid.Row="2" Style="{DynamicResource StandardStyle}"/>
    			<TextBox Margin="5" Grid.Row="2" Grid.Column="1" Text="{Binding ContainerName}" VerticalAlignment="Center" />
                <TextBlock Style="{DynamicResource StandardStyle}" Grid.Row="3" Text="{Binding [AccountEditorView_Maitre], Source={StaticResource localizer}}" />
    			<StackPanel Grid.Column="1" Orientation="Horizontal" Grid.Row="3" d:LayoutOverrides="Height" Grid.ColumnSpan="3">
                    <!--Master local-->
                    <RadioButton Margin="8" IsChecked="{Binding Master, ConverterParameter=Local, Converter={StaticResource syncConverter}}">
    					<StackPanel Orientation="Vertical" >
    						<Image Source="{DynamicResource LocalToAzure}" d:LayoutOverrides="Width" />
                            <TextBlock Text="{Binding [AccountEditorView_Local], Source={StaticResource localizer}}" Style="{DynamicResource SmallStyle}"/>
    					</StackPanel>
					</RadioButton>
                    <!--Master Azure-->
                    <RadioButton Margin="8" IsChecked="{Binding Master, ConverterParameter=Azure, Converter={StaticResource syncConverter}}">
                        <StackPanel Orientation="Vertical" >
    						<Image Source="{DynamicResource AzureToLocal}" d:LayoutOverrides="Width" />
                            <TextBlock Text="{Binding [AccountEditorView_Azure], Source={StaticResource localizer}}" Style="{DynamicResource SmallStyle}"/>
    					</StackPanel>
					</RadioButton>
    			</StackPanel>

                <TextBlock Text="{Binding [AccountEditorView_RepertoireLocal], Source={StaticResource localizer}}" Grid.Row="2" Grid.Column="2" Style="{DynamicResource StandardStyle}" />
    			<Grid Grid.Row="2" Grid.Column="3" >
    				<Grid.ColumnDefinitions>
    					<ColumnDefinition Width="*"/>
    					<ColumnDefinition Width="Auto"/>
    				</Grid.ColumnDefinitions>
    				<TextBox Margin="5" Text="{Binding LocalFolder}" VerticalAlignment="Center" />
    				<Button Content="..." Grid.Column="1" Margin="5" Command="{Binding SelectFolderCommand}" VerticalAlignment="Center"/>
    			</Grid>
                <TextBlock Style="{DynamicResource StandardStyle}" Grid.Row="3" Text="{Binding [AccountEditorView_Suppression], Source={StaticResource localizer}}" Grid.Column="2" d:LayoutOverrides="Height"/>
				<CheckBox Grid.Row="3" Grid.Column="3" IsChecked="{Binding Delete}" d:LayoutOverrides="Width, Height" VerticalAlignment="Center">
					<Image Source="{DynamicResource Delete32}" Width="48" Height="48"/>
				</CheckBox>
                <!--IsPublished-->
                <TextBlock Style="{DynamicResource StandardStyle}" Grid.Row="4" Text="{Binding [AccountEditorView_Partager], Source={StaticResource localizer}}" />
				<Grid Grid.Column="1" Grid.Row="4" HorizontalAlignment="Left">
                    <Grid.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsCheckingPublication}" Value="True">
                                    <Setter Property="UIElement.Visibility" Value="Visible" />
                                </DataTrigger>

                                <DataTrigger Binding="{Binding IsCheckingPublication}" Value="False">
                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Grid.Style>
					<ProgressBar Height="64" Width="64" Visibility="Visible" Style="{DynamicResource ProgressBarBusyIndicator}" IsIndeterminate="True" />
				</Grid>
				     
                <CheckBox Grid.Row="4" Grid.Column="1"  d:LayoutOverrides="Width, Height" IsChecked="{Binding IsPublished}" HorizontalAlignment="Left" VerticalAlignment="Center">
                    <CheckBox.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsCheckingPublication}" Value="False">
                                    <Setter Property="UIElement.Visibility" Value="Visible" />
                                </DataTrigger>

                                <DataTrigger Binding="{Binding IsCheckingPublication}" Value="True">
                                    <Setter Property="UIElement.Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </CheckBox.Style>
					<Image Source="{DynamicResource IsPublished}" Width="48" Height="48"/>
				</CheckBox>
    		</Grid>
    	</Grid>
        <!-- La barre d'outils-->
    	<Border x:Name="border" Grid.Row="2" Background="Black" >
    		<Grid x:Name="grid" Background="Black" Opacity="1" >
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition Width="Auto"/>
    				<ColumnDefinition Width="Auto"/>
    				<ColumnDefinition Width="*"/>
    				<ColumnDefinition Width="Auto"/>
    				<ColumnDefinition Width="Auto"/>
    			</Grid.ColumnDefinitions>
				
    			<StackPanel d:LayoutOverrides="Height" Orientation="Horizontal">
                    <!--Enregistrer-->
    				<Button
    					x:Name="btnSync" Style="{DynamicResource Win8ButtonStyle}"
    					Command="{Binding CreateSyncProjectCommand}" >
    					<StackPanel Orientation="Vertical">
    						<Image Source="{DynamicResource Save}" Height="48"/>
                            <TextBlock TextWrapping="Wrap" Foreground="White" Text="{Binding [AccountEditorView_Enregistrer], Source={StaticResource localizer}}" HorizontalAlignment="Center"/>
    					</StackPanel>
    				</Button>
                    <!--Tester-->
    				<Button
    					x:Name="btnTester" Style="{DynamicResource Win8ButtonStyle}"
    					Command="{Binding TestConnexionCommand}" >
    					<StackPanel Orientation="Vertical">
    						<Image Source="{DynamicResource Tester}" Height="48"/>
                            <TextBlock TextWrapping="Wrap" Foreground="White" Text="{Binding [AccountEditorView_Tester], Source={StaticResource localizer}}" HorizontalAlignment="Center"/>
    					</StackPanel>
    				</Button>
                    
                </StackPanel>
    		</Grid>
    	</Border>
	</Grid>
</UserControl>
